<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pages extends CI_Controller {
    function __construct() {
        parent::__construct();
        
        $this->load->helper('url');
        $this->load->helper('html');
    }
    
    public function index() {
        $this->load->view('phase1/index');
    }
    
    public function about_wnb() {
        $this->load->view('phase1/wnb');
    }
    
    public function previous_lambakans() {
        $this->load->view('phase1/previous_gatherings');
    }
    
    public function contact_us() {
        $this->load->view('phase1/contact');
    }
    
    
    
    
    
    
    //----------------- admin functions:
    // WHAT'S WRONG WITH THESE GLOBALS????!!!!
    var $real_user = "wnbwnbwnb";
    var $real_password = 'akosibatmanhahaha';
    var $isLoggedIn = false;
    
    function login() {
        $this->load->view('admin/login');
    }
    
    function validate() {
        if(isset($_POST['btnLogin'])) {
            $inputUser = $this->input->post('txtuser');
            $inputPassword = $this->input->post('txtpassword');
            
            global $real_user, $real_password, $isLoggedIn;
            
            if(($inputUser == $real_user) && ($inputPassword == $real_password)) {
                $isLoggedIn = true;
                redirect('dashboard');
            }
            else {
                redirect('lamabakan_admin');
            }
        }
    }
    
    
    //admin dashboard pages.....
    function valid_login() {
        $isLoggedIn = true;  //remove value later!
        
        if($isLoggedIn == true) {  //change this to 'TRUE' later!
            $this->load->view('admin/dashboard');
        }
        else {
            redirect('error');
        }
    }
    
    
    function admin_about() {
        $isLoggedIn = true;  //remove value later!
        
        if($isLoggedIn == true) {  //change this to 'TRUE' later!
            $this->load->view('admin/aboutwnb');
        }
        else {
            redirect('error');
        }
    }
    
    
    function archives() {
        $isLoggedIn = true;  //remove value later!
        
        if($isLoggedIn == true) {  //change this to 'TRUE' later!
            $this->load->view('admin/archives');
        }
        else {
            redirect('error');
        }
    }
    
    function myaccount() {
        $isLoggedIn = true;  //remove value later!
        
        if($isLoggedIn == true) {  //change this to 'TRUE' later!
            $this->load->view('admin/myaccount');
        }
        else {
            redirect('error');
        }
    }
    
    
    
    
    
    
    
    
    
}


?>
